<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class mod_marca extends CI_Model {
    
    function __construct()
    {
        parent::__construct();
    }

    public function insert_marca()
    {
        $data['nombre'] = $this->input->post('nombre');
        $this->db->insert('marca',$data);                        
    }
    
    public function update_marca()
    {
        $data['nombre'] = $this->input->post('nombre');
        $this->db->where('marca.id_marca',$this->input->post('id_marca'));
        $this->db->update('marca',$data);	
    }
    
    public function delete_marca($id_marca)
    {
        $this->db->where('marca.id_marca',$id_marca );
        $this->db->delete('marca');
    }
    
    public function carga_tabla()
    {          
       	return $this->db->query("
            SELECT marca.id_marca, 
                marca.nombre
            FROM
                marca");   
    }
    
    public function carga_datos($id_marca)
    {          
       	return $this->db->query("
            SELECT marca.id_marca, 
                marca.nombre
            FROM
                marca
            WHERE marca.id_marca='".$id_marca."' LIMIT 1");   
    }
}